//
// Created by Alex on 2021/9/16.
//

#include <iostream>
#include <cstring>

#include "main.h"

using namespace std;

int main(int argc, char *argv[]) {
    cout << "19373311\n";
    if (argc == 4) {
        strcpy(input_filename, argv[1]);
        strcpy(output_filename, argv[2]);
        strcpy(error_filename, argv[3]);
    }
    preserved();
    printf("compiling %s\n", input_filename);
    lexical_result lexicalResult = lexical_analysis(input_filename, false);
//    lexicalResult.print_to_file(output_filename);
    printf("finish lexical analysis\n");
    syntax_result *syntaxResult = syntax_analysis(lexicalResult);
    printf("finish syntax analysis\n");
    syntaxResult->print(output_filename, error_filename);
#ifdef RESULT_TO_SCR
    syntaxResult->print(stdout);
#endif
    return 0;
}
